package com.axzhengxin.platform.business.controller;

import com.axzhengxin.platform.business.domain.BizApplyInfo;
import com.axzhengxin.platform.business.service.IBizAllApplyService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;

/**
 * @Author AHZJ0005
 * @Date 2021/2/26-10:07
 **/
@RestController
@RequestMapping("/business/BizAllApply")
public class BizAllApplyController extends BaseController {

    @Autowired
    private IBizAllApplyService bizAllApplyService;

/*
    @PreAuthorize("@ss.hasPermi('business:BizAllApply:list')")
*/
    @RequestMapping("/list")
    public TableDataInfo list( BizApplyInfo bizApplyInfo, Integer statusFlag) {
        if (statusFlag!=null) {
            if (statusFlag == 1) {
                //待审核状态   status=10
                bizApplyInfo.setStatus(10);
                bizApplyInfo.setStatusAnother(1010);
                bizApplyInfo.setBizType("APPLY");
            }
            if (statusFlag == 2) {
                //待授信状态
                bizApplyInfo.setStatus(1010);
                bizApplyInfo.setBizType("APPROVE");
            }
            if (statusFlag == 3) {
                //待放款状态
                bizApplyInfo.setStatus(1010);
                bizApplyInfo.setBizType("LOAN");
            }
            if (statusFlag == 4) {
                //已结束状态 --放款流程  status=
                bizApplyInfo.setStatus(2000);
                bizApplyInfo.setBizType("LOAN");
            }
            if (statusFlag == 5) {
                //已拒绝状态 --status=3000
                bizApplyInfo.setStatus(3000);
            }
            if (statusFlag == 6) {
                //已撤销状态 --status=4000
                bizApplyInfo.setStatus(4000);
            }
        }
        startPage();
        List<BizApplyInfo> list = bizAllApplyService.list(bizApplyInfo);
        return getDataTable(list);
    }
}
